#include <stdio.h>

#define IN  1
#define OUT 0

int main()
{
    int c, state, laststate, wl, i;
    wl = 0;
    state = OUT;
    laststate = OUT;

    while ((c = getchar()) != EOF)
    {
        if(c == ' ' || c == '\t' || c == '\n')
        {
            state = OUT;            
        }
        else if(state == OUT)
        {
            state = IN;
        }        

        if(state == IN)
        {
            putchar(c);
            wl++;
        }
        else if(laststate != OUT)
        {
            printf(" ");
            for(i = 0; i < wl; i++)
            {
                putchar('#');
            }
            wl = 0;
            printf("\n");
        }
        
        laststate = state;
    }
    return 0;
}